<?php 

include("../JO_02_function.php");
include("../JO_01_configuration.php");
$JO_MySQL = new mysqli( $JO_DB_host, $JO_DB_user, $JO_DB_password, $JO_DB_database );
$JO_MySQL -> query( "SET NAMES 'UTF8'" );
$key=isset($_GET['SO_chude'])?$_GET['SO_chude']:"";
if($key!=''){
$sql='Select * from `contract` where `contract`.`delete` is null and `contract`.`key`='.$key;
		
$result=JO_query($sql);
if($result->num_rows)
$row=$result->fetch_array();

   ?>

<form method="post" action="JO_05_execution.php" target="JO_integration_asynchronous" enctype="multipart/form-data">

<table>
  <input type="hidden"						name="JO_query"				value="contact"/>
  <input type="hidden" name="id" value="<?=isset($row['key'])?$row['key']:""?>"   />
  <input type="hidden" name="log" value="<?=isset($row['log'])?$row['log']:""?>"   />
  <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Type</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
      <select name="Type" id="Type">
      <option value="" <?=isset($row['type'])?($row['type']==''?"selected='selected'":" "):""?> >---ch?n type---</option>
      <option <?=isset($row['type'])?($row['type']=='Contract'?"selected='selected'":" "):""?>>Contract</option>
      <option <?=isset($row['type'])?($row['type']=='settlement'?"selected='selected'":" "):""?>>settlement</option>
      <option <?=isset($row['type'])?($row['type']=='attornment'?"selected='selected'":" "):""?>>attornment</option>
      </select>
          
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">organization</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="organization"  value="<?=isset($row['organization'])?$row['organization']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
 <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">file</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
            
           <span style="display: block;">
           <input type="text" id="textup" readonly="readonly" style="width:480px" value="<?=isset($row['file'])?$row['file']:""?>" /></span> 
            <span style="cursor: pointer;" id="showup" onclick="showupdate()">Upload New File</span>
            <input type="file" name="file" id="file" value="<?=isset($row['file'])?$row['file']:""?>"   style="width:480px !important;z-index:999;display: none;"/>
        </div></td>
    </tr>
  <tbody id="extendcontent" style="display:none;">
  
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">subject</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="subject"  value="<?=isset($row['subject'])?$row['subject']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
   <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Note</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="note" id="Note" value="<?=isset($row['note'])?$row['note']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Update</div></th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <label><?=isset($row['update'])?$row['update']:""?></label>
        </div></td>
    </tr>
  </tbody>
  <tr class="trextend">
    <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">
        <input  type="button" value="Extend"  id="tab" class="JO_button"   onclick="show();"/>
      </div>
  </th>
    <td width="246px"><input type="submit" value="Submit"  id="submit" class="JO_button"   style="width:240px !important" /></td>
    <td style="padding-left:0 !important"><input type="button" value="Cancel"  id="cancel" class="JO_button"   style="width:240px !important" onClick="move();"/></td>
  </tr>
</table>
</form>
<?php   }if($key==''){?>
<form method="post" action="JO_05_execution.php" target="JO_integration_asynchronous" onsubmit="return kiemtra()" enctype="multipart/form-data"
>
  <table>
    <input type="hidden"						name="JO_query"				value="contact_add"/>
    <input type="hidden" name="id" value="<?=isset($row['key'])?$row['key']:""?>"   />
    <input type="hidden" name="log" value="<?=isset($row['log'])?$row['log']:""?>"   />
    <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Type</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
      <select name="Type" id="Type">
      <option value="" <?=isset($row['type'])?($row['type']==''?"selected='selected'":" "):""?> >---ch?n type---</option>
      <option <?=isset($row['type'])?($row['type']=='Contract'?"selected='selected'":" "):""?>>Contract</option>
      <option <?=isset($row['type'])?($row['type']=='settlement'?"selected='selected'":" "):""?>>settlement</option>
      <option <?=isset($row['type'])?($row['type']=='attornment'?"selected='selected'":" "):""?>>attornment</option>
      </select>
          
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">organization</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="organization"  value="<?=isset($row['organization'])?$row['subject']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
 <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">file</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="file" name="file" value="<?=isset($row['file'])?$row['file']:""?>"   style="width:480px !important;z-index:999"/>
        </div></td>
    </tr>
  <tbody id="extendcontent" style="display:none;">
  
  <tr>
      <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">subject</div>
      </th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="subject"  value="<?=isset($row['subject'])?$row['subject']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
   <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Note</div>
      </th>
      <td colspan="3"><div  style="width:424px;float:left;padding-left:0">
          <input type="text" name="note" id="Note" value="<?=isset($row['note'])?$row['note']:""?>"   style="width:480px !important"/>
        </div></td>
    </tr>
    <tr>
      <th style="vertical-align:middle;width:60px"> <div style="width:60px;float:left">Update</div></th>
      <td colspan="4"><div  style="width:424px;float:left;padding-left:0">
          <label><?=isset($row['update'])?$row['update']:""?></label>
        </div></td>
    </tr>
  </tbody>
  <tr class="trextend">
    <th style="vertical-align:middle;width:70px"> <div style="width:60px;float:left">
        <input  type="button" value="Extend"  id="tab" class="JO_button"   onclick="show();"/>
      </div>
  </th>
    <td width="246px"><input type="submit" value="Submit"  id="submit" class="JO_button"   style="width:240px !important" /></td>
    <td style="padding-left:0 !important"><input type="button" value="Cancel"  id="cancel" class="JO_button"   style="width:240px !important" onClick="move2();"/></td>
  </tr>
  </table>
</form>
<?php    }?>
